package com.twetec.cms.common.constant;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;

public enum ArticleEnum {

    /**
     * 文章属性
     */
    ATTRIBUTE_WORD("WEN_ZI", "文字"),
    ATTRIBUTE_IMAGE("TU_PIAN", "图片"),
    ATTRIBUTE_VIDEO("SHI_PIN", "视频"),

    /**
     * 文章类型
     */
    TYPE_TU_WEN_ZI_XUN("TU_WEN_ZI_XUN", "图文资讯"),
    TYPE_XIA_ZAI_WEN_JIAN("XIA_ZAI_WEN_JIAN", "下载文件"),
    TYPE_TIAO_ZHUAN_LIAN_JIE("TIAO_ZHUAN_LIAN_JIE", "跳转链接"),
    TYPE_GONG_GAO_ZI_XUN("GONG_GAO_ZI_XUN", "公告资讯"),

    /**
     * 发布渠道
     */
    RELEASE_CHANNEL_API("API", "API"),
    RELEASE_CHANNEL_H5("H5", "H5"),
    RELEASE_CHANNEL_PC("PC", "PC"),

    /**
     * 文章排序类型
     */
    SORT_TYPE_ZHI_DING("ZHI_DING", "置顶"),
    SORT_TYPE_FA_BU_SHI_JIAN("FA_BU_SHI_JIAN", "发布时间"),
    SORT_TYPE_ZI_DING_YI("ZI_DING_YI", "自定义"),

    /**
     * 文章状态
     */
    STATUS_ALL("ALL", "全部"),
    STATUS_CAO_GAO("CAO_GAO", "草稿"),
    STATUS_DAI_SHEN_HE("DAI_SHEN_HE", "待审核"),
    STATUS_DAI_XIU_GAI("DAI_XIU_GAI", "待修改"),
    STATUS_YI_FA_BU("YI_FA_BU", "已发布"),
    STATUS_YI_XIA_JIA("YI_XIA_JIA", "已下架"),
    STATUS_YI_GUO_QI("YI_GUO_QI", "已过期");



    private String value;

    private String name;

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    ArticleEnum(String value, String name) {
        this.value = value;
        this.name = name;
    }

    /**
     * 获取集合List
     * @return
     */
    public static List<HashMap<String,String>> getArtilceEnumList() {
        List<HashMap<String, String>> list = new ArrayList<>();
        for (ArticleEnum adPositionEnum : EnumSet.allOf(ArticleEnum.class)) {
            HashMap<String, String> map = new HashMap<>();
            map.put(adPositionEnum.value, adPositionEnum.name);
            list.add(map);
        }
        return list;
    }

    /**
     * 获取集合Map
     * @return
     */
    public static HashMap<String,String> getArticleEnumMap() {
        HashMap<String, String> map = new HashMap<>();
        for (ArticleEnum articleEnum : EnumSet.allOf(ArticleEnum.class)) {
            map.put(articleEnum.value, articleEnum.name);
        }
        return map;
    }


}
